── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.18.0
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
If you use it in published research, please cite either one:
- Gu, Z. Complex Heatmap Visualization. iMeta 2022.
- Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
genomic data. Bioinformatics 2016.
The new InteractiveComplexHeatmap package can directly export static
complex heatmaps into an interactive Shiny app with zero effort. Have a try!
This message can be suppressed by:
suppressPackageStartupMessages(library(ComplexHeatmap))
========================================
library(circlize)
========================================
circlize version 0.4.16
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/
If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
in R. Bioinformatics 2014.
This message can be suppressed by:
suppressPackageStartupMessages(library(circlize))
========================================
2.4 Load AntigenProcessingPresentation, MHC class I, MHC class II pathways
antigen_processing_geneset <-msigdbr(species ="Homo sapiens") %>%filter(gs_name =="KEGG_ANTIGEN_PROCESSING_AND_PRESENTATION") %>%select(human_gene_symbol, ensembl_gene)# HLA class I (A-C)hla_class1 <-msigdbr(species ="Homo sapiens") %>%distinct(gene_symbol, ensembl_gene) %>%filter(str_detect(gene_symbol, "^HLA-(A|B|C)"))# HLA class II (ie any HLA that is HLA-D*)hla_class2 <-msigdbr(species ="Homo sapiens") %>%distinct(gene_symbol, ensembl_gene) %>%filter(str_detect(gene_symbol, "^HLA-(?=D)"))# Remove genes that are in HLA class II or are HLA A-C from the KEGG antigen processing gene list since it's a duplicationantigen_processing_geneset <- antigen_processing_geneset %>%filter(!(human_gene_symbol %in% hla_class1$gene_symbol),!(human_gene_symbol %in% hla_class2$gene_symbol))
2.5 Extract KEGG antigen processing genes
p101_antigen_processing_rsem <- p101_rsem %>%filter(gene_id_stable %in% antigen_processing_geneset$ensembl_gene)p103_antigen_processing_rsem <- p103_rsem %>%filter(gene_id_stable %in% antigen_processing_geneset$ensembl_gene)p104_antigen_processing_rsem <- p104_rsem %>%filter(gene_id_stable %in% antigen_processing_geneset$ensembl_gene)p105_antigen_processing_rsem <- p105_rsem %>%filter(gene_id_stable %in% antigen_processing_geneset$ensembl_gene)p106_antigen_processing_rsem <- p106_rsem %>%filter(gene_id_stable %in% antigen_processing_geneset$ensembl_gene)p108_antigen_processing_rsem <- p108_rsem %>%filter(gene_id_stable %in% antigen_processing_geneset$ensembl_gene)p109_antigen_processing_rsem <- p109_rsem %>%filter(gene_id_stable %in% antigen_processing_geneset$ensembl_gene)p110_antigen_processing_rsem <- p110_rsem %>%filter(gene_id_stable %in% antigen_processing_geneset$ensembl_gene)p111_antigen_processing_rsem <- p111_rsem %>%filter(gene_id_stable %in% antigen_processing_geneset$ensembl_gene)all_antigen_processing_rsem <- p101_antigen_processing_rsem[,c("gene_id", "gene_id_stable", "P101")] %>%full_join(p103_antigen_processing_rsem[,c("gene_id", "gene_id_stable", "P103")], by =c("gene_id", "gene_id_stable")) %>%full_join(p104_antigen_processing_rsem[,c("gene_id", "gene_id_stable", "P104")], by =c("gene_id", "gene_id_stable")) %>%full_join(p105_antigen_processing_rsem[,c("gene_id", "gene_id_stable", "P105")], by =c("gene_id", "gene_id_stable")) %>%full_join(p106_antigen_processing_rsem[,c("gene_id", "gene_id_stable", "P106")], by =c("gene_id", "gene_id_stable")) %>%full_join(p108_antigen_processing_rsem[,c("gene_id", "gene_id_stable", "P108")], by =c("gene_id", "gene_id_stable")) %>%full_join(p109_antigen_processing_rsem[,c("gene_id", "gene_id_stable", "P109")], by =c("gene_id", "gene_id_stable")) %>%full_join(p110_antigen_processing_rsem[,c("gene_id", "gene_id_stable", "P110")], by =c("gene_id", "gene_id_stable")) %>%full_join(p111_antigen_processing_rsem[,c("gene_id", "gene_id_stable", "P111")], by =c("gene_id", "gene_id_stable")) %>%mutate(Type ="AntigenProcessingPresentation")## For the 4 pt: Remove lowly expressed genes, ie. gene was expressed (>=1 TPM) in at least one patientbest_antigen_processing_rsem_4pt <- all_antigen_processing_rsem %>%rowwise() %>%filter((P101 >=1) | (P103 >=1) | (P104 >=1) | (P108 >=1))## For all pt: Remove lowly expressed genes, ie. gene was expressed (>=1 TPM) in at least one patientbest_antigen_processing_rsem_9pt <- all_antigen_processing_rsem %>%rowwise() %>%filter((P101 >=1) | (P103 >=1) | (P104 >=1) | (P105 >=1) | (P106 >=1) | (P108 >=1) | (P109 >=1) | (P110 >=1) | (P111 >=1))
2.6 Extract top HLA class I (ie HLA-A, HLA-B, HLA-C)